from phi.agent import Agent
from phi.model.openai import OpenAIChat
from phi.tools.duckduckgo import DuckDuckGo

# 禁用代理设置
# import os
#
# from phidata.cookbook.readers.firecrawl_reader_example import api_key
#
# os.environ['HTTP_PROXY'] = ''
# os.environ['HTTPS_PROXY'] = ''

# 首先确保设置了正确的 API key
# 可以通过环境变量设置：export OPENAI_API_KEY='your-api-key'
api_key ="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"
web_agent = Agent(
    name="Web Agent",
    model=OpenAIChat(id="gpt-4",api_key=api_key),
    tools=[DuckDuckGo()],
    instructions=["Always include sources"],
    show_tool_calls=True,
    markdown=True,
)
web_agent.print_response("Tell me about OpenAI Sora?", stream=True)
